EEL_MODS	+= optee_os

# optee os
DEPS_TEE += optee_os
$(eval $(call deftargets_git,optee_os,OTOS))
$(eval $(call deftargets_download,optee_os,OTOS,$$(OPTEE_VERSION),$$(OPTEE_VERSION)))

PHONY-optee_os += optee_os optee_os-clean
optee_os: $(BUILD_DEPS) $(TC64_PATH) $(TC32_PATH) optee_os-prepare
	@\rm -f $(O_OTOS_DIR)/.build_done.optee_os
	$(EELQ)$(MAKE) $(JOB_OPT) \
		-C $(S_OTOS_DIR) \
		ARCH=$(OPTEE_ARCH) \
		PLATFORM=$(OPTEE_PLAT) \
		DEBUG=$(OTOS_DEBUG) \
		O=$(O_OTOS_DIR) \
		CROSS_COMPILE=$(TC_PREFIX) \
		CROSS_COMPILE_core=$(TC_PREFIX) \
		CROSS_COMPILE_ta_arm64=$(TC64_PREFIX) \
		CROSS_COMPILE_ta_arm32=$(TC32_PREFIX) \
		$(OTOS_CFG_OPTS) \
		$(OTOS_TARGETS)
	$(EELQ5)touch $(O_OTOS_DIR)/.build_done.optee_os

$(TF_A_BL32_BINS): $(BUILD_DEPS) $(OTOS_DEPS)
	@$(MAKE_THIS) optee_os

# for $(O_OTOS_DIR)/export-ta_$(OPTEE_ARCH2)
$(O_OTOS_DIR)/.build_done.optee_os:
	@$(MAKE_THIS) optee_os

# FIXME: optee_os-clean
optee_os-clean:
	\rm -f $(O_OTOS_DIR)/.build_done.optee_os
	\rm -fr $(O_OTOS_DIR)
